/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package cn.knet.sp.ncrm.modules.customer.visitrecord.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import org.hibernate.validator.constraints.Length;

import java.util.Date;

import javax.validation.constraints.NotNull;

import cn.knet.sp.ncrm.common.persistence.DataEntity;

/**
 * 销售跟踪Entity
 * @author 冯亚鹏
 * @version 2015-08-28
 */
public class VisitRecord extends DataEntity<VisitRecord> {
	
	private static final long serialVersionUID = 1L;
	private Long version;		// version
	private String customerStatusId;		// 客户状态
	private String customerStatusDetailId;		// 客户状态明细
	private Date dateCreated;		// 创建时间
	private Date lastUpdated;		// 最后更新时间
	private String potentialCustomerId;		// 潜在客户id
	private String visitRecord;		// 回访记录描述
	private String visitResult;		// (目前废弃）
	private String visitResultDetailId;		// (目前废弃）
	private String createUserId;		// 创建用户
	private String lastCustomerStatusId;		// 最后客户状态
	private String lastCustomerStatusDetailId;		// 最后客户明细状态
	private String operationType;		// 操作类型
	private Integer visitNum;		// 回访次数
	private String targetProducts;		// 目标产品
	private Date predictSaleDate;		// 预计成单日期
	private String predictSaleAmount;		// 预计成单金额
	private Long predictSalePercentage;		// 预计成单可能性（百分比）整数
	
	public VisitRecord() {
		super();
	}

	public VisitRecord(String id){
		super(id);
	}

	@NotNull(message="version不能为空")
	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}
	
	@Length(min=1, max=64, message="客户状态长度必须介于 1 和 64 之间")
	public String getCustomerStatusId() {
		return customerStatusId;
	}

	public void setCustomerStatusId(String customerStatusId) {
		this.customerStatusId = customerStatusId;
	}
	
	@Length(min=0, max=64, message="客户状态明细长度必须介于 0 和 64 之间")
	public String getCustomerStatusDetailId() {
		return customerStatusDetailId;
	}

	public void setCustomerStatusDetailId(String customerStatusDetailId) {
		this.customerStatusDetailId = customerStatusDetailId;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
	
	@Length(min=1, max=64, message="潜在客户id长度必须介于 1 和 64 之间")
	public String getPotentialCustomerId() {
		return potentialCustomerId;
	}

	public void setPotentialCustomerId(String potentialCustomerId) {
		this.potentialCustomerId = potentialCustomerId;
	}
	
	@Length(min=0, max=500, message="回访记录描述长度必须介于 0 和 500 之间")
	public String getVisitRecord() {
		return visitRecord;
	}

	public void setVisitRecord(String visitRecord) {
		this.visitRecord = visitRecord;
	}
	
	public String getVisitResult() {
		return visitResult;
	}

	public void setVisitResult(String visitResult) {
		this.visitResult = visitResult;
	}
	
	public String getVisitResultDetailId() {
		return visitResultDetailId;
	}

	public void setVisitResultDetailId(String visitResultDetailId) {
		this.visitResultDetailId = visitResultDetailId;
	}
	
	@Length(min=0, max=64, message="创建用户长度必须介于 0 和 64 之间")
	public String getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(String createUserId) {
		this.createUserId = createUserId;
	}
	
	@Length(min=0, max=64, message="最后客户状态长度必须介于 0 和 64 之间")
	public String getLastCustomerStatusId() {
		return lastCustomerStatusId;
	}

	public void setLastCustomerStatusId(String lastCustomerStatusId) {
		this.lastCustomerStatusId = lastCustomerStatusId;
	}
	
	@Length(min=0, max=64, message="最后客户明细状态长度必须介于 0 和 64 之间")
	public String getLastCustomerStatusDetailId() {
		return lastCustomerStatusDetailId;
	}

	public void setLastCustomerStatusDetailId(String lastCustomerStatusDetailId) {
		this.lastCustomerStatusDetailId = lastCustomerStatusDetailId;
	}
	
	@Length(min=0, max=64, message="操作类型长度必须介于 0 和 64 之间")
	public String getOperationType() {
		return operationType;
	}

	public void setOperationType(String operationType) {
		this.operationType = operationType;
	}
	
	public Integer getVisitNum() {
		return visitNum;
	}

	public void setVisitNum(Integer visitNum) {
		this.visitNum = visitNum;
	}
	
	@Length(min=0, max=100, message="目标产品长度必须介于 0 和 100 之间")
	public String getTargetProducts() {
		return targetProducts;
	}

	public void setTargetProducts(String targetProducts) {
		this.targetProducts = targetProducts;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getPredictSaleDate() {
		return predictSaleDate;
	}

	public void setPredictSaleDate(Date predictSaleDate) {
		this.predictSaleDate = predictSaleDate;
	}
	
	public String getPredictSaleAmount() {
		return predictSaleAmount;
	}

	public void setPredictSaleAmount(String predictSaleAmount) {
		this.predictSaleAmount = predictSaleAmount;
	}
	
	public Long getPredictSalePercentage() {
		return predictSalePercentage;
	}

	public void setPredictSalePercentage(Long predictSalePercentage) {
		this.predictSalePercentage = predictSalePercentage;
	}


	@Override
	public void preInsert() {
		this.version = 1L;//暂时设置为1
		this.lastUpdated = new Date();
		this.dateCreated = new Date();
		super.preInsert();
	}

	@Override
	public void preUpdate() {
		this.version = 1L;//暂时设置为1
		this.lastUpdated = new Date();
		super.preUpdate();
	}
}